package com.ipan.weixin.msg.qrcode;

import com.ipan.weixin.msg.AbstractJsonMsg;

/**
 * 创建二维码消息
 * 
 * @author iPan
 * @version 2013-12-26
 */
public class CreateTwoDimenCodeMsg extends AbstractJsonMsg {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 8697100505620676511L;

	/** 该二维码有效时间，以秒为单位。 最大不超过1800。 */
	private Long expire_seconds;
	
	/** 二维码类型，QR_SCENE为临时,QR_LIMIT_SCENE为永久 */
	private String action_name;
	
	/** 二维码详细信息 */
	private ActionInfo action_info;
	
	public CreateTwoDimenCodeMsg(Long expire_seconds, String action_name, Scene scene) {
		this.expire_seconds = expire_seconds;
		this.action_name = action_name;
		this.action_info = new ActionInfo(scene);
	}
	
	public CreateTwoDimenCodeMsg(Long expire_seconds, String action_name, Integer scene) {
		this.expire_seconds = expire_seconds;
		this.action_name = action_name;
		this.action_info = new ActionInfo(scene);
	}

	public CreateTwoDimenCodeMsg(Long expire_seconds, String action_name, ActionInfo action_info) {
		this.expire_seconds = expire_seconds;
		this.action_name = action_name;
		this.action_info = action_info;
	}

	public Long getExpire_seconds() {
		return expire_seconds;
	}

	public void setExpire_seconds(Long expire_seconds) {
		this.expire_seconds = expire_seconds;
	}

	public String getAction_name() {
		return action_name;
	}

	public void setAction_name(String action_name) {
		this.action_name = action_name;
	}

	public ActionInfo getAction_info() {
		return action_info;
	}

	public void setAction_info(ActionInfo action_info) {
		this.action_info = action_info;
	}

	/**
	 * 二维码详细信息
	 */
	class ActionInfo {
		
		private Scene scene;
		
		public ActionInfo(Scene scene) {
			this.scene = scene;
		}
		
		public ActionInfo(Integer scene) {
			this.scene = new Scene(scene);
		}

		public Scene getScene() {
			return scene;
		}

		public void setScene(Scene scene) {
			this.scene = scene;
		}
		
		public void setScene(Integer scene) {
			this.scene = new Scene(scene);
		}

	}

	class Scene {
		
		/** 场景值ID，临时二维码时为32位非0整型，永久二维码时最大值为1000（目前参数只支持1--1000） */
		private Integer scene_id;
		
		public Scene(Integer scene_id) {
			this.scene_id = scene_id;
		}

		public Integer getScene_id() {
			return scene_id;
		}

		public void setScene_id(Integer scene_id) {
			this.scene_id = scene_id;
		}

	}
	
	public static void main(String[] args) {
		System.out.println(new CreateTwoDimenCodeMsg(1800L, "actionName", 100));
	}

}
